﻿using RecruitStudents.Utility;
using RecruitStudents.Utility.Json;
using RecruitStudents.Utility.Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RecruitStudents.Client.BLL
{
    class ServiceFinancial
    {
        WS_Financial.FinancialService financialService = new WS_Financial.FinancialService();
        WS_Financial.MySoapHeader objHeader = new WS_Financial.MySoapHeader();
        internal ServiceFinancial()
        {
            objHeader.Username = "admin";
            objHeader.Password = "xy";
            financialService.MySoapHeaderValue = objHeader;
        }

        #region 获取考试缴费信息
        internal DataTable GetExamineePayFee(string strExamPlaceNO, string strIdentityCard)
        {
            return financialService.GetExamineePayFee(strExamPlaceNO, strIdentityCard).ToDataTable();
        }
        #endregion

        #region  保存缴费确认的信息（更新缴费状态字段 保存财务订单付款 保存财务订单明细）
        internal JsonMessage UpdateSpecialityInfoState(TB_SignUpStudentsNetPayFee_Head strJsonPayFeeModel, List<TB_SignUpStudentsNetPayFee_Detail> strJsonPayFee_DetailList,
            List<TB_Exam_SignUpStudentsSpeciality> strJsonStudentsSpeciality)
        {
            try
            {
                var message = financialService.UpdateSpecialityInfoState(strJsonPayFeeModel.ToJson(), strJsonPayFee_DetailList.ToJson(), strJsonStudentsSpeciality.ToJson())
                    .ToList<JsonMessage>();
                return message;
            }
            catch (Exception ex)
            {
                JsonMessage message = new JsonMessage();
                message.State = "false";
                message.Msg = "保存失败," + ex.Message;
                return message;
            }
        }
        #endregion

        #region 查询 考试缴费信息
        internal DataTable SearchPayFeeInfo(string strExamPlaceID, string strExamLevel, string strSpecialityKindsNO, string strPaySource,
            string IsFee, string StartDate, string EndDate, string OrdNO)
        {
            return financialService.SearchPayFeeInfo(strExamPlaceID, strExamLevel, strSpecialityKindsNO, strPaySource, IsFee, StartDate, EndDate, OrdNO).ToDataTable();
        }
        #endregion

        #region 获取 考生报考专业,考试级别(根据考生ID)
        internal DataTable GetExameeSpeciality_ExamLevelBySignUpID(string strIdCard)
        {
            return financialService.GetExameeSpeciality_ExamLevelBySignUpID(strIdCard).ToDataTable();
        }
        #endregion
    }
}
